package com.ssy.lingxi.enhance.model.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.List;

/**
 * 修改生产通知单 - DTO
 * @author fhj
 * @date 2020/10/22
 * @version 2.0.0
 */
@Data
public class UpdateProduceNoticeOrderDTO {

    @NotNull(message = "外部工作流类型不能为空")
    @ApiModelProperty(value = "外部工作流类型")
    private Integer outerTaskType;

    @NotNull(message = "生产通知单ID不能为空")
    @ApiModelProperty(value = "生产通知单ID")
    private Long id;

    @NotBlank(message = "通知单摘要不能为空")
    @ApiModelProperty(value = "通知单摘要")
    private String summary;

    @NotNull(message = "加工企业会员ID不能为空")
    @ApiModelProperty(value = "加工企业会员ID")
    private Long processMemberId;

    @NotNull(message = "加工企业会员角色ID不能为空")
    @ApiModelProperty(value = "加工企业会员角色ID")
    private Long processRoleId;

    @NotBlank(message = "加工企业会员名称不能为空")
    @ApiModelProperty(value = "加工企业会员名称")
    private String processName;

    @NotNull(message = "通知单来源不能为空")
    @ApiModelProperty(value = "通知单来源: 1-订单加工 2-商品加工")
    private Integer source;

    @NotNull(message = "交期不能为空")
    @ApiModelProperty(value = "交期")
    private Long deliveryDate;

    @NotNull(message = "配送方式不能为空")
    @ApiModelProperty(value = "配送方式: 1-物流 2-自提")
    private Integer deliveryType;

    @ApiModelProperty(value = "收货地址id")
    private Long receiverAddressId;

    @ApiModelProperty(value = "收货地址")
    private String receiveAddress;

    @ApiModelProperty(value = "收货人姓名")
    private String receiveUserName;

    @ApiModelProperty(value = "收货人电话")
    private String receiveUserTel;

    @ApiModelProperty(value = "通知单其他要求(交付说明, 付款说明, 税费说明, 物流说明, 包装说明, 其他说明, 附件名称, 附件地址)")
    private HashMap<String, Object> otherAsk;

    @Valid
    @NotEmpty(message = "生产通知单明细不能为空")
    @ApiModelProperty(value = "生产通知单明细")
    private List<ProduceNoticeOrderDetailDTO> details;

    @Data
    public static class ProduceNoticeOrderDetailDTO {

        @ApiModelProperty(value = "订单ID")
        private Long orderId;

        @ApiModelProperty(value = "订单号")
        private String orderNo;

        @ApiModelProperty(value = "订单详情ID")
        private Long orderDetailId;

        @NotNull(message = "商品ID不能为空")
        @ApiModelProperty(value = "商品ID")
        private Long productId;

        @NotBlank(message = "商品名称不能为空")
        @ApiModelProperty(value = "商品名称")
        private String productName;

        @NotBlank(message = "品类不能为空")
        @ApiModelProperty(value = "品类")
        private String category;

        @NotBlank(message = "品牌不能为空")
        @ApiModelProperty(value = "品牌")
        private String brand;

        @NotBlank(message = "单位不能为空")
        @ApiModelProperty(value = "单位")
        private String unit;

        @ApiModelProperty(value = "采购数量（订单数量）")
        private Double purchaseCount;

        @ApiModelProperty(value = "剩余加工数量（一般来说不能小于0，如果要强行加工的话也可以正常操作）")
        private Double surplusProcessNum;

        @NotNull(message = "加工数量不能为空")
        @ApiModelProperty(value = "加工数量")
        private Double processNum;

        @NotNull(message = "是否含税不能为空")
        @ApiModelProperty(value = "是否含税")
        private Integer isHasTax;

        @NotNull(message = "税率不能为空")
        @ApiModelProperty(value = "税率")
        private Double taxRate;

        @NotNull(message = "加工单价不能为空")
        @ApiModelProperty(value = "加工单价")
        private Double processPrice;

        @NotNull(message = "加工费不能为空")
        @ApiModelProperty(value = "加工费")
        private Double processTotalPrice;

        @NotEmpty(message = "商品属性不能为空")
        @ApiModelProperty(value = "商品属性")
        private HashMap<String, Object> property;
    }
}
